package com.test.practice.enumTest;


import org.apache.commons.lang3.StringUtils;

public enum YesOrNo {

	YES("Y","是"),
    NO("N","否");

	private String code;

    private String desc;

    YesOrNo(String code,String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static String getDescByCode(String code){
        if(StringUtils.isBlank(code)){
            return "";
        }
        for (YesOrNo yesOrNo : YesOrNo.values()){
            if(yesOrNo.getCode().equals(code)){
                return yesOrNo.getDesc();
            }
        }
        return code;
    }

//    public static Map<String,String> generatorMap(){
//        Map<String,String> map = new HashMap<>(2);
//        for(YesOrNo yesOrNo : YesOrNo.values()){
//            map.put(yesOrNo.getCode(),yesOrNo.getDesc());
//        }
//        return map;
//    }
    
    public static void main(String[] args) {
		System.out.println(YesOrNo.YES.name());
	}
}
